package com.Algorithm.HUAWEI.one20211020;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2022/02/24/18:20
 * @Description:
 * @Target:
 */
public class 字符串最后一个单词的长度 {
    public static void main(String[] args) throws Exception{
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String str = bufferedReader.readLine();
        boolean flag = false;   // 判斷是否是空格結束
        int n = 0;
        for (int i = str.length()-1; i >= 0; i--) {
            n++;
            if (str.charAt(i)==' '){
                flag = true;
               break;
            }
        }

        if (flag == true){
            System.out.println(n-1);
        }else {
            System.out.println(n);
        }

    }
}
